
#include "libBigNum.h"


big_number big_number::operator=(const big_number & rhs)
{
	if(this == &rhs)
		return *this;

	_arr_size = rhs._arr_size;
	_sign = rhs._sign;
	_fractionalPart = rhs._fractionalPart;
	//free(this->_num_array);
	_num_array = (unsigned long*) malloc( _arr_size*sizeof(unsigned long));

	if ( _num_array == NULL)
		throw exception(); //TODO def execption can't allocate memory

	memcpy(_num_array, rhs._num_array, _arr_size*sizeof(unsigned long));
	return *this;

}

big_number big_number::operator+=(const big_number & rhs)
{
	*this = (*this+rhs);
	return *this;
}

big_number big_number::operator-=(const big_number & rhs)
{
	*this = (*this-rhs);
	return *this;
}

big_number big_number::operator*=(const big_number & rhs)
{
	*this = (*this*rhs);
	return *this;
}

big_number big_number::operator/=(const big_number & rhs)
{
	*this = (*this/rhs);
	return *this;
}